package BinarySearch;

public class RightMost {
  int fn(int arr[], int target) {
    int i = 0, j = arr.length - 1;
    while (i <= j) {
      int mid = (i + j) >>> 1;
      if (target < arr[mid]) {
        j = mid - 1;
      } else {
        i = mid + 1;
      }
    }
    return i - 1;
  }
}
